﻿@{
    ViewBag.Title = "Edit_Menu";
    Layout = "~/Views/Shared/_LayoutChild.cshtml";
}
@model Agro.Models.T_Menu
@section head
{
    @Html.Partial("_ModelValidator")
    <script language="javascript" type="text/javascript">
        function Save(t) {//t是弹出窗口的对象 ，主要用来关门该弹出窗口
            //菜单名称
            var menuName = $("#Menu_NAME").val();
            if (menuName == "") {
                alert("菜单名称不能为空!");
                return;
            }
            //Url地址
            var menuUrl = $("#Menu_Url").val();
            if (menuUrl == "") {
                alert("菜单URL不能为空!");
                return;
            }
            $.funSaveForm("/SystemManage/Menu/Save_Menu", "formDetail", function (d) {
                var type = $("#Menu_ID").val() >"0" ? "edit":"add" ; //判断是新增还是编辑
                if (d == undefined || d == "") {
                    parent.asyncbox.tips('保存失败!', 'error');
                    return;
                }
                else {
                    $("#Menu_ID").val(d);
                    parent.asyncbox.tips('保存成功!', 'success');
                    MainFrame().refreshTreeNode(type);
                    parent.$.close(t.id);
                }
            });
        }
    </script>
}
<!--主窗体，页面都需要的div-->
<div class="ui-layout-center" style="overflow: hidden;">
    @using (Html.BeginForm("", "", FormMethod.Post, new Dictionary<string, object> { { "id", "formDetail" } }))
    {
        @Html.HiddenFor(model => model.Menu_ID) 
        @Html.HiddenFor(model => model.Menu_ParentID)
        <div class='b-col'>
            <div class="col-name">
                <font color="red">*</font><font color="blue"> 菜单名称：</font></div>
            <div class="col-input">@Html.TextBoxFor(model => model.Menu_NAME)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                <font color="blue">菜单路径：</font></div>
            <div class="col-input">@Html.TextBoxFor(model => model.Menu_Url)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                <font color="blue">图标：</font></div>
            <div class="col-input">@Html.TextBoxFor(model => model.Menu_Image)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                是否启用：</div>
            <div class="col-input">
                <label>
                    是</label>@Html.RadioButtonFor(model => model.Menu_IsShow, "1") &nbsp;&nbsp;<label>否</label>@Html.RadioButtonFor(model => model.Menu_IsShow, "0")</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                菜单排序：</div>
            <div class="col-input">@Html.TextBoxFor(model => model.Menu_Order)</div>
        </div>
        <div class='b2-col'>
            <ul>
                <li>
                    @Html.ValidationMessageFor(m => m.Menu_NAME)
                </li>
                <li>
                    @Html.ValidationMessageFor(m => m.Menu_Order)
                </li>
            </ul>
        </div>
    }
</div>
